<div [@routerTransition]>
    <div class="content d-flex flex-column flex-column-fluid">
        <sub-header [title]="'PayRecord' | localize" [description]="'PayRecord' | localize">
            <div role="actions">
            </div>
        </sub-header>

        <div [class]="containerClass">
            <div class="card card-custom gutter-b">
                <div class="card-body">

                    <div class="row align-items-center mb-4">
                        <div class="col-2">
                            <label>{{l('type')}}</label>
                            <div class="form-group">
                                <div class="input-group">
                                    <select class="form-control" [(ngModel)]="payType" name="payType">
                                        <option value="">{{l('All')}}</option>
                                        <option value="Pay">{{l('Pay')}}</option>
                                        <option value="Refund">{{l('Refund')}}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-6">
                            <label>{{l('Date')}}</label>
                            <div class="form-group">
                                <div class="input-group">
                                    <date-range-picker [dateRangePickerOptions]='{ "opens": "left"}' needInitDate="true"
                                        #clickDateranger style="width: 60%;" name="clickDateranger"
                                        [(startDate)]="startTime" [(endDate)]="endTime" [allowFutureDate]="false"
                                        [cssStyle]="'dashboard'" [admitDelete]="false">
                                    </date-range-picker>

                                    <button class="btn btn-primary" (click)="getList()"
                                        [buttonBusy]="primengTableHelper.isLoading">
                                        <i class="la la-refresh"></i>
                                        {{l("search")}}
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>


                    <div class="row align-items-center">
                        <!--<Primeng-Datatable-Start>-->
                        <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                            <p-table #dataTable (onLazyLoad)="getList($event)" [value]="primengTableHelper.records"
                                [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false" [lazy]="true"
                                [resizableColumns]="primengTableHelper.resizableColumns"
                                [responsive]="primengTableHelper.isResponsive">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width:5%">{{l('RecordId')}}</th>
                                        <th>{{l('orderNo')}}</th>
                                        <th pSortableColumn="payAmount">
                                            {{l('money')}}
                                            <p-sortIcon field="payAmount"></p-sortIcon>
                                        </th>
                                        <th pSortableColumn="payTime">
                                            {{l('Date')}}
                                            <p-sortIcon field="payTime"></p-sortIcon>
                                        </th>
                                        <th>{{l('from')}}</th>
                                        <th>{{l('type')}}</th>
                                        <th style="width:25%;">{{l('tradNumber')}}</th>
                                        <th>{{l('payWay')}}</th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-record let-i="rowIndex">
                                    <tr [pSelectableRow]="record" [attr.trid]="record.id">
                                        <td style="width:5%"> {{transIndex(i)}}</td>
                                        <td>
                                            <span>{{record.orderNo}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.payAmount}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.payTime| date : "yyyy/MM/dd HH:mm"}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.orderFrom}}</span>
                                        </td>
                                        <td>
                                            <span *ngIf="record.payType==0">{{l('Pay')}}</span>
                                            <span *ngIf="record.payType==1">{{l('Refund')}}</span>
                                        </td>
                                        <td style="width:25%;">
                                            <span>{{record.tradNumber}}</span>
                                        </td>
                                        <td>
                                            <span>{{record.payFrom}}</span>
                                        </td>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="emptymessage" let-records>
                                    <tr *ngIf="primengTableHelper.records">
                                        <td colspan="8" class="text-center">
                                            <img class="emptymessage"
                                                src="/assets/common/images/placeholder/deviceHolder.png" />
                                        </td>
                                    </tr>
                                </ng-template>
                            </p-table>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                    (onPageChange)="getList($event)"
                                    [totalRecords]="primengTableHelper.totalRecordsCount"
                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{l('TotalRecordsCount', primengTableHelper.totalRecordsCount)}}
                                </span>
                            </div>
                        </div>
                        <!--<Primeng-Datatable-End>-->
                    </div>

                </div>
            </div>
        </div>
    </div>